<template>
  <amplify-authenticator>
    <div>
      My App
      <amplify-sign-out></amplify-sign-out>
    </div>
  </amplify-authenticator>
</template>

<script>
export default {
  name: "app",
  data() {
    return {
      // name: '',
      // description: ''
    };
  },
  methods: {
    async signUp() {
      try {
        const { user } = await Auth.signUp({
          username,
          password,
          attributes: {
            email, // optional
            phone_number, // optional - E.164 number convention
            // other custom attributes
          },
        });
        console.log(user);
      } catch (error) {
        console.log("error signing up:", error);
      }
    },
    async signIn() {
      try {
        const user = await Auth.signIn(username, password);
      } catch (error) {
        console.log("error signing in", error);
      }
    },
    async resendConfirmationCode() {
      try {
        await Auth.resendSignUp(username);
        console.log("code resent successfully");
      } catch (err) {
        console.log("error resending code: ", err);
      }
    },
    async signOut() {
      try {
        await Auth.signOut();
      } catch (error) {
        console.log("error signing out: ", error);
      }
    },
  },
};
</script>
